const os = require('os');
function getIp(){
    var interface = os.networkInterfaces();
    for(var devName in interface){
        var iface = interface[devName];
        for(let i=0; i<iface.length; i++){
            let alias = iface[i];
            // console.log(alias);
            if(alias.family=='IPv4' && alias.address!='127.0.0.1' && !alias.internal){
                return alias.address
            }
        }
    }
}
let ip = getIp();
console.log(`ip: ${ip}`);